//
//  WLMyScoreProfitController.m
//  WanLian
//
//  Created by muzhuang on 2018/10/11.
//  Copyright © 2018年 wanlian. All rights reserved.
//

#import "WLMyScoreProfitController.h"
#import "WLScoreFlowCell.h"
#import "WLScoreFlowModel.h"
//#import "WLScoreRankingVController.h"
#import "WLScoreRankingSubController.h"
#import "WLExchangeScoreVController.h"
#import "WLExtractScoreVController.h"
#import "WLWebViewController.h"
#import "WLINTChangeDetailController.h"
#import "UIScrollView+EmptyDataSet.h"
#import "WLHandleINTIndicationVC.h"

@interface WLMyScoreProfitController ()<UITableViewDelegate,UITableViewDataSource, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>

@property (nonatomic, strong) UILabel *labCurScore;
@property (nonatomic, copy) NSDictionary *dictMyScore;

@property (nonatomic, strong) UITableView *tbScoreFlow;
@property (nonatomic, assign) NSInteger flowPage;
@property (nonatomic, strong) NSMutableArray *arrFlows;

@end

@implementation WLMyScoreProfitController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self userCurrentScore];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"我的收益";
    
    WLWkSelf
    UIView *vBackProfit = [[UIView alloc] initWithFrame:CGRectMake(WLScaleX(16), WLScaleX(20), WIDTH_SCREEN_WL-WLScaleX(32), WLScaleX(154))];
    [self.view addSubview:vBackProfit];
    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = vBackProfit.bounds;//CGRectMake(0, 0, vBackProfit.bounds.size.width, WLScaleX(104));//vBackProfit.bounds;
    gradientLayer.colors = @[(__bridge id)wlUIColorRGB(0x1A59E2).CGColor,(__bridge id)wlUIColorRGB(0x2292F5).CGColor];
    gradientLayer.startPoint = CGPointMake(0, 0);
    gradientLayer.endPoint = CGPointMake(1, 0);
    [vBackProfit.layer addSublayer:gradientLayer];
    
    vBackProfit.layer.cornerRadius = 5;//WLScaleX(5);
    vBackProfit.layer.masksToBounds = YES;
    
//    UILabel *labCurrent = [[UILabel alloc] init];//WithFrame:CGRectMake(WLScaleX(24), WLScaleX(20), 100, 20)];
//    labCurrent.font = [WLCommonTool fontTypePingFangSCRegular:14];
//    labCurrent.textColor = [UIColor whiteColor];
//    labCurrent.text = @"当前可用总积分";
//    [vBackProfit addSubview:labCurrent];
//    [labCurrent mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(vBackProfit.mas_top).offset(WLScaleX(20));
//        make.left.equalTo(vBackProfit.mas_left).offset(WLScaleX(24));
//        make.height.equalTo(@20);
//    }];
    
    UIButton *btnCurrent = [[UIButton alloc] initWithFrame:CGRectMake(WLScaleX(20), WLScaleX(20), 135, 20)];
    [btnCurrent setImage:[UIImage imageNamed:@"tip_help"] forState:UIControlStateNormal];
    [btnCurrent setTitle:@"当前可用总积分 " forState:UIControlStateNormal];
    btnCurrent.titleLabel.font = [WLCommonTool fontTypePingFangSCRegular:14];
    [btnCurrent setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btnCurrent setTitleEdgeInsets:UIEdgeInsetsMake(0, -btnCurrent.imageView.image.size.width, 0, btnCurrent.imageView.image.size.width)];
    [btnCurrent setImageEdgeInsets:UIEdgeInsetsMake(0, btnCurrent.titleLabel.bounds.size.width, 0, -btnCurrent.titleLabel.bounds.size.width)];
    
    [btnCurrent addTarget:self action:@selector(currentNoteAction) forControlEvents:UIControlEventTouchUpInside];
    [vBackProfit addSubview:btnCurrent];
//    [btnCurrent mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(labCurrent.mas_right);
//        make.centerY.equalTo(labCurrent.mas_centerY);
//        make.size.mas_equalTo(CGSizeMake(40, 40));
//    }];
    
    UIButton *btnRange = [[UIButton alloc] init];
    btnRange.titleLabel.font = [WLCommonTool fontTypePingFangSCRegular:12];
    [btnRange setTitle:@"积分排行榜" forState:UIControlStateNormal];
    [btnRange addTarget:self action:@selector(scoreRangeAction) forControlEvents:UIControlEventTouchUpInside];
    [vBackProfit addSubview:btnRange];
    [btnRange mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(vBackProfit.mas_right).offset(-WLScaleX(8));
        make.centerY.equalTo(btnCurrent.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(90, 40));
    }];
    
    _labCurScore = [[UILabel alloc] initWithFrame:CGRectMake(WLScaleX(24), WLScaleX(20)+20+5, vBackProfit.bounds.size.width-WLScaleX(24), 45)];
    _labCurScore.font = [WLCommonTool fontTypePingFangSCMedium:28];
    _labCurScore.textColor = [UIColor whiteColor];
    [vBackProfit addSubview:_labCurScore];
    
//    CAGradientLayer *gradientBottom = [CAGradientLayer layer];
//    gradientBottom.frame = CGRectMake(0, WLScaleX(104), vBackProfit.bounds.size.width, WLScaleX(50));
//    gradientBottom.colors = @[(__bridge id)wlUIColorRGB(0x52BBFF).CGColor,(__bridge id)wlUIColorRGB(0x41E6FF).CGColor];
//    gradientBottom.startPoint = CGPointMake(0, 0);
//    gradientBottom.endPoint = CGPointMake(1, 0);
//    [vBackProfit.layer addSublayer:gradientBottom];
    UIView *vBottom = [[UIView alloc] initWithFrame:CGRectMake(0, WLScaleX(104), vBackProfit.bounds.size.width, WLScaleX(50))];
    vBottom.backgroundColor = wlLightTextColor;
    [vBackProfit addSubview:vBottom];
    vBottom.alpha = 0.4;
    CAGradientLayer *gradientBottom = [CAGradientLayer layer];
    gradientBottom.frame = vBottom.bounds;
    gradientBottom.colors = @[(__bridge id)wlUIColorRGB(0x52BBFF).CGColor,(__bridge id)wlUIColorRGB(0x41E6FF).CGColor];
    gradientBottom.startPoint = CGPointMake(0, 0);
    gradientBottom.endPoint = CGPointMake(1, 0);
    [vBottom.layer addSublayer:gradientBottom];
    
    UIButton *btneExchange = [[UIButton alloc] init];
    [btneExchange setImage:[UIImage imageNamed:@"exchage_card"] forState:UIControlStateNormal];
    btneExchange.titleLabel.font = [WLCommonTool fontTypePingFangSCRegular:12];
    [btneExchange setTitle:@" INT操作手册" forState:UIControlStateNormal];
    [btneExchange addTarget:self action:@selector(exchangeAction) forControlEvents:UIControlEventTouchUpInside];
    [vBackProfit addSubview:btneExchange];
    [btneExchange mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(vBackProfit.mas_left).offset(WLScaleX(20));
        make.bottom.equalTo(vBackProfit.mas_bottom).offset(-WLScaleX(5));
        make.right.equalTo(vBackProfit.mas_centerX).offset(-WLScaleX(20));
        make.height.equalTo(@(WLScaleX(40)));
    }];
    
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = [UIColor whiteColor];
    [vBackProfit addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(vBackProfit.mas_centerX);
        make.bottom.equalTo(vBackProfit.mas_bottom).offset(-WLScaleX(7));
        make.size.mas_equalTo(CGSizeMake(WLScaleX(1), WLScaleX(36)));
    }];
    
    UIButton *btneExtract = [[UIButton alloc] init];
    [btneExtract setImage:[UIImage imageNamed:@"extract_accout"] forState:UIControlStateNormal];
    btneExtract.titleLabel.font = [WLCommonTool fontTypePingFangSCRegular:12];
    [btneExtract setTitle:@" 提取到INT账户" forState:UIControlStateNormal];
    [btneExtract addTarget:self action:@selector(extractAction) forControlEvents:UIControlEventTouchUpInside];
    [vBackProfit addSubview:btneExtract];
    [btneExtract mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(vBackProfit.mas_centerX).offset(WLScaleX(20));
        make.bottom.equalTo(btneExchange.mas_bottom);
        make.width.height.equalTo(btneExchange);
    }];
    
    UILabel *labFlow = [[UILabel alloc] init];
    labFlow.font = [WLCommonTool fontTypePingFangSCMedium:20];
    labFlow.textColor = wlBlackColor;
    labFlow.text = @"收益流水";
    [self.view addSubview:labFlow];
    [labFlow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(vBackProfit.mas_bottom).offset(WLScaleX(15));
        make.left.equalTo(vBackProfit.mas_left);
        make.size.mas_equalTo(CGSizeMake(100, 30));
    }];
    
    UIButton *btnRule = [[UIButton alloc] initWithFrame:CGRectMake(WIDTH_SCREEN_WL-WLScaleX(10)-100, CGRectGetMaxY(vBackProfit.frame)+WLScaleX(15), 100, 30)];
    [btnRule setImage:[UIImage imageNamed:@"help_gray"] forState:UIControlStateNormal];
    [btnRule setTitle:@"积分获取规则 " forState:UIControlStateNormal];
    btnRule.titleLabel.font = [WLCommonTool fontTypePingFangSCRegular:12];
    [btnRule setTitleColor:wlLightTextColor forState:UIControlStateNormal];
    [btnRule setTitleEdgeInsets:UIEdgeInsetsMake(0, - btnRule.imageView.image.size.width, 0, btnRule.imageView.image.size.width)];
    [btnRule setImageEdgeInsets:UIEdgeInsetsMake(0, btnRule.titleLabel.bounds.size.width, 0, -btnRule.titleLabel.bounds.size.width)];
    [btnRule addTarget:self action:@selector(scoreRuleAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btnRule];
//    [btnRule mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(labFlow.mas_centerY);
//        make.right.equalTo(weakSelf.view.mas_right).offset(-WLScaleX(10));
//        make.size.mas_equalTo(CGSizeMake(150, 30));
//    }];
    
    UIView *underLine = [[UIView alloc] initWithFrame:CGRectMake(WIDTH_SCREEN_WL-WLScaleX(10)-95, CGRectGetMaxY(vBackProfit.frame)+WLScaleX(15)+30-7, 70, 1)];
    underLine.backgroundColor = wlUnderlineColor;
    [self.view addSubview:underLine];
    
//    UILabel *labRule = [[UILabel alloc] init];
//    labRule.textAlignment = NSTextAlignmentRight;
//    labRule.font = [WLCommonTool fontTypePingFangSCRegular:12];
//    labRule.textColor = wlLightTextColor;
//    labRule.attributedText = [[NSAttributedString alloc] initWithString:@"积分获取规则" attributes:@{NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleSingle]}];
//    [self.view addSubview:labRule];
////    [mutableAttributedString addAttribute:NSUnderlineStyleAttributeName value:    [NSNumber numberWithInteger:NSUnderlineStyleNone]range:boldRange1];
//    [labRule mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(btnRule.mas_centerY);
//        make.right.equalTo(btnRule.mas_left);
////        make.size.mas_equalTo(CGSizeMake(120, 20));
//    }];
    
    _arrFlows = [[NSMutableArray alloc] init];
    _flowPage = 1;
    _tbScoreFlow = [[UITableView alloc] init];
    _tbScoreFlow.delegate = self;
    _tbScoreFlow.dataSource = self;
    _tbScoreFlow.rowHeight = WLScaleX(60);
    _tbScoreFlow.tableFooterView = [UIView new];
    [self.view addSubview:_tbScoreFlow];
    _tbScoreFlow.emptyDataSetSource = self;
    _tbScoreFlow.emptyDataSetDelegate = self;
    [_tbScoreFlow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(labFlow.mas_bottom);
        make.left.bottom.right.equalTo(weakSelf.view);
    }];
    
    self.tbScoreFlow.mj_header = [WLFreshGifHeader headerWithRefreshingBlock:^{
        weakSelf.flowPage = 1;
        [weakSelf.arrFlows removeAllObjects];
        weakSelf.tbScoreFlow.mj_footer = nil;
        [weakSelf reqScoreFlow];
    }];
    
//    [self userCurrentScore];
    [self reqScoreFlow];
}

- (void)addFooterRefresh
{
    WLWkSelf
    self.tbScoreFlow.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        [weakSelf reqScoreFlow];
    }];
}

- (void)userCurrentScore
{
    WLWkSelf
    NSDictionary *conditions = @{};
    NSDictionary *pages = @{@"page":@1,@"num":@10};
    NSDictionary *paramsp = @{@"conditions":conditions,@"page":pages};
    [WLHttpManager WLRequestMethod:RequestTypePost urlStr:@"score/app/user/list" withParamsDic:paramsp success:^(NSDictionary *successDict) {
        if (([successDict[@"object"] isKindOfClass:[NSNull class]])) {
            return ;
        }
        NSArray *arrScore = successDict[@"object"];
        if (arrScore.count>0) {
            weakSelf.dictMyScore = arrScore.firstObject;
        }
        [weakSelf showCurrentScore];
    } failure:^(NSString *errorMsg, NSInteger errorTag) {
        [weakSelf showHUDMessage:errorMsg];
        [weakSelf showCurrentScore];
    } error:^(NSError *error) {

    } inView:self.view];
}
//{
//  dscore = 321981;
//  id = 41;
//  intnum = 10;
//  iscore = 0;
//  phone = 18658169592;
//  rmb = 100;
//  score = 321981;
//  username = "肖政";
//}

- (void)showCurrentScore
{
    if (self.dictMyScore != nil)
    {
        NSString *strDscore = [NSString stringWithFormat:@"%@",self.dictMyScore[@"score"]];
        NSString *strScore = [NSString stringWithFormat:@"%@ ≈%@元",strDscore,self.dictMyScore[@"rmb"]];
        NSRange range = [strDscore rangeOfString:@"."];
        if (range.location != NSNotFound) {
            NSMutableAttributedString *strProfit = [[NSMutableAttributedString alloc] initWithString:strScore];
            [strProfit addAttribute:NSFontAttributeName
                              value:[WLCommonTool fontTypePingFangSCMedium:12]
                              range:NSMakeRange(range.location, strScore.length-range.location)];
            _labCurScore.attributedText = strProfit;
        }
        else
        {
            NSMutableAttributedString *strProfit = [[NSMutableAttributedString alloc] initWithString:strScore];
            [strProfit addAttribute:NSFontAttributeName
                              value:[WLCommonTool fontTypePingFangSCMedium:12]
                              range:NSMakeRange(strDscore.length, strScore.length-strDscore.length)];
            _labCurScore.attributedText = strProfit;
        }
    }
    else
    {
        NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:@"0 ≈ 0元"];
        [attStr addAttribute:NSFontAttributeName
                       value:[WLCommonTool fontTypePingFangSCMedium:12]
                       range:NSMakeRange(1, attStr.length-1)];
        _labCurScore.attributedText = attStr;
    }
}

- (void)currentNoteAction
{
    WLWebViewController *webView = [[WLWebViewController alloc] init];
//    webView.urlStr = @"http://47.75.195.106/help/helpdetail.html?detail=0";
    webView.urlStr = [NSString stringWithFormat:@"%@/help/helpdetail.html?detail=0",[WLCommonTool getWebHost]];
//    webView.titleStr = @"用户服务协议";
    [self.navigationController pushViewController:webView animated:YES];
}

- (void)scoreRuleAction
{
    WLWebViewController *webView = [[WLWebViewController alloc] init];
//    webView.urlStr = @"http://47.75.195.106/help/helpdetail.html?detail=2";
//    https://www.zeerong.com/help/getRules.html
    webView.urlStr = [NSString stringWithFormat:@"%@/help/getRules.html",[WLCommonTool getWebHost]];
    [self.navigationController pushViewController:webView animated:YES];
}

- (void)scoreRangeAction
{
    WLScoreRankingSubController *rankingController = [[WLScoreRankingSubController alloc] init];
    [self.navigationController pushViewController:rankingController animated:YES];
}

- (void)exchangeAction
{
    
//    WLExchangeScoreVController *exchangeController = [[WLExchangeScoreVController alloc] init];
//    exchangeController.enableScore = self.dictMyScore[@"dscore"];
    WLHandleINTIndicationVC *handleINTVC = [[WLHandleINTIndicationVC alloc] init];
    [self.navigationController pushViewController:handleINTVC animated:YES];
}

//{
//    dscore = 222013;
//    id = 41;
//    intnum = "1332.366";
//    iscore = 48;
//    phone = 18658169592;
//    rmb = "222.109";
//    score = 222061;
//    username = "肖政";
//}
- (void)extractAction
{
    WLExtractScoreVController *extractController = [[WLExtractScoreVController alloc] init];
    extractController.enableScore = self.dictMyScore[@"iscore"];
    extractController.enableInt = self.dictMyScore[@"intnum"];
    [self.navigationController pushViewController:extractController animated:YES];
}

- (void)reqScoreFlow
{
    WLWkSelf
    NSDictionary *conditions = @{};
    NSDictionary *pages = @{@"page":[NSNumber numberWithInteger:_flowPage],@"num":@10};
    NSDictionary *paramsp = @{@"conditions":conditions,@"page":pages};
    [WLHttpManager WLRequestMethod:RequestTypePost urlStr:@"score/app/user/scorewater" withParamsDic:paramsp success:^(NSDictionary *successDict) {
        __strong __typeof(weakSelf) strongSelf = weakSelf;
        [strongSelf.tbScoreFlow.mj_header endRefreshing];
        NSInteger flowCount = [successDict[@"count"] integerValue];
        if (strongSelf.flowPage==1&&flowCount>10)
        {
            [strongSelf addFooterRefresh];
        }
        NSArray *arrList = [WLScoreFlowModel mj_objectArrayWithKeyValuesArray:successDict[@"object"]];
        if (arrList.count>0)
        {
//            [strongSelf.tbScoreFlow.mj_footer endRefreshing];
            [strongSelf.arrFlows addObjectsFromArray:arrList];
            if (strongSelf.arrFlows.count >= flowCount) {
                [strongSelf.tbScoreFlow.mj_footer endRefreshingWithNoMoreData];
            }
            else
            {
                [strongSelf.tbScoreFlow.mj_footer endRefreshing];
            }
            [strongSelf.tbScoreFlow reloadData];
        }
        else
        {
            [strongSelf.tbScoreFlow.mj_footer endRefreshingWithNoMoreData];
            [strongSelf setNoDataState];
        }
        strongSelf.flowPage += 1;
    } failure:^(NSString *errorMsg, NSInteger errorTag) {
        [weakSelf showHUDMessage:errorMsg];
        [weakSelf.tbScoreFlow.mj_header endRefreshing];
        [weakSelf.tbScoreFlow.mj_footer endRefreshing];
    } error:^(NSError *error) {
        [weakSelf.tbScoreFlow.mj_header endRefreshing];
        [weakSelf.tbScoreFlow.mj_footer endRefreshing];
    } inView:nil];
}
- (void)setNoDataState {
    
}
#pragma mark - UITableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.arrFlows.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *strFlow = @"flowCell";
    WLScoreFlowCell *cell = [tableView dequeueReusableCellWithIdentifier:strFlow];
    if (!cell) {
        cell = [[WLScoreFlowCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strFlow];
//        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    WLScoreFlowModel *scoreFlow = self.arrFlows[indexPath.row];
    
    cell.labTitle.text = scoreFlow.stype;
    if (scoreFlow.addtime>0) {
        cell.labTime.text = [WLCommonTool timeToYMDHMS:scoreFlow.addtime];
    }
    else
    {
        cell.labTime.text = @"";
    }
    
    if ([scoreFlow.score hasPrefix:@"-"])
    {
        cell.labScore.text = [NSString stringWithFormat:@"%.6f",scoreFlow.score.floatValue];
        cell.labScore.textColor = wlRedColor;
    }
    else
    {
        cell.labScore.text = [NSString stringWithFormat:@"+%.6f",scoreFlow.score.floatValue];
        cell.labScore.textColor = wlGreenColor;
    }
    
    cell.labDevice.text = scoreFlow.pname;
//    if ([scoreFlow.stype isEqualToString:@"共享奖励"]) {
//        cell.labDevice.text = [NSString stringWithFormat:@"%@",scoreFlow.pname];
//    }
//    else
//    {
//        cell.labDevice.text = scoreFlow.pname;
//    }
    CGRect rectScore = cell.labScore.frame;
    CGRect rectDevice = cell.labDevice.frame;
    CGFloat isShow = WIDTH_SCREEN_WL-WLScaleX(16)-9-160-5;
    CGFloat isHide = WIDTH_SCREEN_WL-WLScaleX(16)-160;
    if (scoreFlow.trantype == 4)
    {
        rectScore.origin.x = isShow;
        rectDevice.origin.x = isShow;
        cell.ivArrow.hidden = NO;
        cell.selectionStyle = UITableViewCellSelectionStyleGray;
    }
    else
    {
        rectScore.origin.x = isHide;
        rectDevice.origin.x = isHide;
        cell.ivArrow.hidden = YES;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.labScore.frame = rectScore;
    cell.labDevice.frame = rectDevice;
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    WLScoreFlowModel *scoreFlow = self.arrFlows[indexPath.row];
    if (scoreFlow.trantype == 4)
    {
        WLINTChangeDetailController *changeDetailController = [[WLINTChangeDetailController alloc] init];
        changeDetailController.scoreModel = scoreFlow;
        [self.navigationController pushViewController:changeDetailController animated:YES];
    }
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma mark - DZNEmpty
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
    return [UIImage imageNamed:@"no_data"];
}

- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
    NSString *title = @"还没有收益流水~";
    NSDictionary *attributes = @{
                                 NSFontAttributeName:[WLCommonTool fontTypePingFangSCRegular:17],
                                 NSForegroundColorAttributeName:wlDarkGrayColor
                                 };
    return [[NSAttributedString alloc] initWithString:title attributes:attributes];
}

- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
{
    return YES;
}
@end
